package br.mikhas.container.config;

import br.mikhas.container.config.Dependency.DependencyTarget;

/**
 * Describes an resouce in the container and its properties, configuration and
 * relations with other sources.
 * 
 * @author Mikhail Domanoski
 * 
 */
public interface BeanDefinition {

	/**
	 * Returns the name of the resource that will be used to find it on the
	 * container.
	 */
	public String getName();

	/**
	 * Gets the type of the resource
	 * 
	 * @return the type of the resource
	 */
	public Class<?> getType();

	/**
	 * Gets the name of the scope in which the resource will have it's
	 * life-cycle.
	 */
	public String getScope();

	/**
	 * Get the name of the resources which the current depends on
	 */
	public Dependency[] getDependencies();

	/**
	 * Get the name of the resources which the current depends on
	 * 
	 * @param The
	 *            type of dependency usage
	 */
	public Dependency[] getDependencies(DependencyTarget destiny);

	/**
	 * Gets the class which instantiates the resource
	 */
	public Class<?> getInstantiatingClass();

	/**
	 * Defines the state of the bean definition as initializing
	 */
	public void initialize();

	/**
	 * Defines the bean state as initialized
	 */
	public void initializationDone();

	/**
	 * Gets the name of the method which should be invoked after the bean
	 * creation and property set.
	 * <p>
	 * This must require no arguments and should be used for some bean
	 * initialization.
	 * 
	 * @return The name of the initializaing method
	 */
	public String initializingMethod();

	/**
	 * Gets the name of the method which should be invoked before the
	 * destruction of the bean scope or the application context.
	 * <p>
	 * The method must require no arguments.
	 * 
	 * @return The name of the destroing method
	 */
	public String destroyMethod();

	/**
	 * Checks if the bean is on initialization phase
	 * 
	 * @return
	 */
	public boolean isInitializingPhase();
}
